import { BrowserRouter, Route, Routes } from 'react-router-dom';

import AppForm from '../Home';
import Page1Form from '../page/Page1';
import Page2Form from '../page/Page2';
import TransForm from '../page/TransMain';

// import MdPageForm from '../page/MdPage'
// import EchartPageForm from '../page/EchartPage'

import { lazy, Suspense } from 'react';
const MdPageForm = lazy(() => import('../page/MdPage'));
const EchartPageForm = lazy(() => import('../page/EchartPage'));


export default () => (
    <>
        <BrowserRouter>
            {/* 注册路由 */}
            <Routes>
                <Route path='/' element={<AppForm />} />
                <Route path='/page1' element={<Page1Form />} />
                <Route path='/page2' element={<Page2Form />} />
                <Route path='/trans' element={<TransForm />} />

                {/* <Route path='/mdPage' element={<MdPageForm />} />
                <Route path='/echart' element={<EchartPageForm />} /> */}

                <Route path='/mdPage' element={
                    <Suspense fallback={<h2>加载中....</h2>}>
                        <MdPageForm />
                    </Suspense>
                } />
                <Route path='/echart' element={
                    <Suspense fallback={<h2>加载中....</h2>}>
                        <EchartPageForm />
                    </Suspense>
                } />

            </Routes>
        </BrowserRouter>
    </>
)